extends "../weiershiqinwang-2/weiershiqinwang-2.gd"

func _extInit():
	._extInit()
	lv = 3             #等级的设置
	addSkill("战斗开始时，牺牲自己正前方1格的友军单位，获得其全部三维属性，并对当前目标造成等额的技能伤害", "遗志")

func _onBattleStart():
	._onBattleStart()
	var cha = sys.main.matCha(cell + Vector2(1, 0))
	if cha != null and cha.team == team:
		forceKillCha(cha)
		addBuff(b_weiershi2.new(cha))
		if upgraded == 1:
			cha.isDeath = false
			cha.plusHp(cha.att.maxHp*0.5)
			cha.revive(cha.att.maxHp*0.5)
		yield(reTimer(0.05),"timeout")
		if aiCha != null:
			var dmg = cha.att.atk + cha.att.mgiAtk + cha.att.def
			azurHurtChara(aiCha, dmg, sys.HurtType.WEAPON, sys.AtkType.SKILL, "遗志")


class b_weiershi2:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	func _init(cha):
		attInit()
		id = "b_weiershi2"
		att.atk = cha.att.atk
		att.mgiAtk = cha.att.mgiAtk
		att.def = cha.att.def
		buffName = "遗志"
		dispel = 2